package com.project.controller;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.project.bean.PurchaseInfoBean;
import com.project.bean.PurchaseOrderBean;
import com.project.service.IPurchaseOrderService;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.time.LocalDate;
import java.util.List;

@RestController
@RequiresPermissions("purchaseInfo")
@RequestMapping("purchaseOrder")
public class PurchaseOrderController {
    @Autowired
    private IPurchaseOrderService purchaseOrderService;
    @RequestMapping("findByItem")//动态分页查询采购订单
    public IPage<PurchaseOrderBean> findByItem(Integer pageNO, String supplierName,
                                               LocalDate startDate, LocalDate endDate) {
       return purchaseOrderService.findByItem(pageNO, supplierName, startDate, endDate);
    }
    @RequestMapping("findById")
    public PurchaseOrderBean findById(Integer id) {
        //通过订单id查询订单信息，同时查询该订单的明细信息。在采购明细信息中，需要查询商品名称和品牌。
        return purchaseOrderService.findById(id);
    }
}
